using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ClassEditor
{
    public partial class ShowScriptsForm : Form
    {
        public ShowScriptsForm(string outputText)
        {
            InitializeComponent();
            output.Text = outputText;
        }

        private void Exit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void SaveAs_Click(object sender, EventArgs e)
        {
            FileDialog dlg = new SaveFileDialog();
            dlg.Filter = "(*.sql)|*.sql";
            dlg.FileName = "New File";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                System.IO.StreamWriter sw = null;
                try
                {
                    sw = new System.IO.StreamWriter(dlg.FileName, false);
                    sw.Write(output.Text);
                }
                catch(Exception ex)
                {
                    MessageBox.Show(ex.ToString(), "Error");
                }
                finally
                {
                    if (sw != null)
                        sw.Close();
                }       
            }
        }

    }
}